package base;

public class Test5 {

    public static void main(String[] args) {
        try{
            Thread t = new Thread(() ->{
                throw new RuntimeException("运行时异常");
            });
            t.setUncaughtExceptionHandler((Thread thread, Throwable e) -> {
                e.printStackTrace();
                System.out.println(t + " throws exception: " + e);
            });
            t.start();

        }catch (Exception e){
           e.printStackTrace();
        }


    }

}
